package com.dq.mail.exception;

import com.dq.mail.utils.R;

/**
 * @ClassName: CommonException
 * @Description: TODO
 * @Author: app-backend-public_小强 (QQ:2680825683)
 * @Since: 2023/3/3 14:59
 */
public class CommonException extends RuntimeException {
    private String errorMsg;

    public CommonException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public String getErrorMsg() {
        return this.errorMsg;
    }

    public static R throwError(String errorMsg) {
        throw new CommonException(errorMsg);
    }

    public static R throwError(CommonErrorEnum errorEnum) {
        throw new CommonException(errorEnum.getErrMessage());
    }
}
